package com.cyz.web.app.concurrent;

public class JoinClient {

    private volatile static int i = 0;

    private volatile static int j = 0;

    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            for (i = 0; i < 1000; i++) ;
        });



        Thread t2 = new Thread(() -> {
            for (j = 0; j < 1000; j++) ;
        });
        t1.start();
        t2.start();

        try {
            t1.join();
            t2.join();
        }catch (InterruptedException e){
            e.printStackTrace();
        }
        System.out.printf("i=%s \n", i);
        System.out.printf("j=%s \n", j);
    }


}
